<?php

namespace App\Events;

use App\Events\Event;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class DeviceFilterInfoUpdate extends Event implements ShouldBroadcast
{
    use SerializesModels;

    public $deviceData;
    private $_deviceCode;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($deviceCode, $deviceData)
    {
        $this->deviceData = $deviceData;
        $this->_deviceCode = $deviceCode;
    }

    /**
     * Get the channels the event should be broadcast on.
     *
     * @return array
     */
    public function broadcastOn()
    {
        return ['filter-'.$this->_deviceCode];
    }
}
